import { createRouter, createWebHistory } from 'vue-router'
import page from "./page";
// import Index from "../pages/Commoditymanagement/product/productAdd.vue";
let Index = ()=>import("@/views/Index.vue")
let Indirective = ()=>import("@/directive/Indirective.vue")
const routes = [
  {
    path: '/',
    redirect: '/Index/IndexAbout',
  },
  {
    path: '/Index',
    name: 'Index',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: Index,
    redirect: '/Index/IndexAbout',
    children:[
          {
            path: 'Indirective/:path(.*)',
            name: 'Indirective-chlid',
            component: Indirective,
          },
      {
        path: 'IndexAbout',
        component: () => import(/* webpackChunkName: "about" */ '../views/IndexAbout.vue')
      },
      {
        path: 'MyInfo',
        name:"MyInfo",
        meta:{
          title:"个人信息",
        },
        component: () => import(/* webpackChunkName: "about" */ '../views/MyInfo/MyInfo.vue')
      },
      {
        path: 'MYPassword',
        name:"MYPassword",
        meta:{
          title:"修改密码",
        },
        component: () => import(/* webpackChunkName: "about" */ '../views/MyInfo/MYPassword.vue')
      },
      {
        path: 'Text',
        name:"Text",
        meta:{
          title:"测试页面",
        },
        component: () => import(/* webpackChunkName: "about" */ '../views/text/Text.vue')
      },
      ...page,
      // {
      //   path: 'ProductAdd',
      //   name:"ProductAdd",
      //   meta:{
      //     title:"商品添加",
      //     keepAlive:true
      //   },
      //   component: () => import(/* webpackChunkName: "about" */ '../pages/Commoditymanagement/product/productAdd.vue')
      // },
      // {
      //   path: 'ProductEdit',
      //   name:"ProductEdit",
      //   meta:{
      //     title:"商品编辑",
      //     keepAlive:true
      //   },
      //   component: () => import(/* webpackChunkName: "about" */ '../pages/Commoditymanagement/product/productEdit.vue')
      // },

    ]
  },
  {
    path: '/404',
    name: '404',
    component: () => import(/* webpackChunkName: "about" */ '../views/404.vue')
  },
  {
    path: '/Login',
    name: 'Login',
    component: () => import(/* webpackChunkName: "about" */ '../views/Login.vue')
  },
  {
    path: '/:path(.*)+',
    name: 'gnfd',
    redirect: '/404'
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
